package daily.may0510;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Random;

public class ReviseRandomTest {
    public static void main(String[] args) {
        Random random = new Random();
        ArrayList<Integer> array = new ArrayList<>();
        String[] list = {"王小龙", "何飞洋", "张薇"};
        //放入两个随机数到集合中
        for (int count = 0; count < 2; ) {
            //产生一个0-2的随机数
            int number = random.nextInt(3);
            //不重复则放入集合中
            if (!array.contains(number)) {
                array.add(number);
                count++;
            }
        }
        for (Integer i : array) {
            System.out.println(list[i]);
        }
        System.out.println(LocalDateTime.now());
    }
}
